<template>
  <view class="field-input field-form-item">
    <u-form-item
      :label="widget.showName"
      :required="widget.props.required"
      readonly
    >
      <u-parse style="width: 100%" :html="getShowValue" />
    </u-form-item>
  </view>
</template>

<script>
export default {
  name: 'onlineFieldlabel',
  props: {
    value: {
      type: [String, Number, Date, Boolean]
    },
    widget: {
      type: Object,
      required: true
    }
  },
  computed: {
    bindColumn() {
      return this.widget.column;
    },
    getWidgetText () {
      return this.value;
    },
    getShowValue () {
      if (this.widget && this.widget.widgetType === this.SysCustomWidgetType.Switch) {
        return this.value ? '是' : '否';
      }
      return this.value;
    }
  }
}
</script>
